![]() |
SoundComponentSetOutput |
||||
Header: | Sound.h | Carbon status: | Supported | |
Specifies the kind of audio data the output device component wants to receive.
ComponentResult SoundComponentSetOutput ( ComponentInstance ti, SoundComponentDataPtr requested, SoundComponentDataPtr *actual );
A component instance that identifies your sound component.
A pointer to a sound component data structure that specifies the type of the data your component expects to receive.
This parameter is currently unused.
Returns noErr if successful or an appropriate result code otherwise.
The Apple Mixer’s SoundComponentSetOutput function can be called by a sound output device component to specify the kind of audio data the output device component wants to receive. The Apple Mixer uses that information to determine the type of sound component chain it needs to construct in order to deliver that kind of audio data to your sound output device component. For example, if your sound output device is able to accept 16-bit samples, the Sound Manager doesn’t need to convert 16-bit audio data into 8-bit data.
The following lines of code illustrate how the sound output device component for the Apple Sound Chip might call Apple Mixer’s SoundComponentSetOutput function:
myDataRec.flags = 0; /*ignored here*/
myDataRec.format = kOffsetBinary; /*ASC needs offset binary*/
myDataRec.sampleRate = rate22khz; /*ASC needs 22 kHz samples*/
myDataRec.sampleSize = 8; /*ASC needs 8-bit data*/
myDataRec.numChannels = 2; /*ASC can do stereo*/
myDataRec.sampleCount = 1024; /*ASC uses a 1K FIFO*/
myErr = SoundComponentSetOutput(mySource, &myDataRec, &myActual);
In general, however, a sound output device component shouldn’t need to call the Apple Mixer’s SoundComponentSetOutput function. Instead, it can indicate the type of data it expects to receive when it calls the OpenMixerSoundComponent function. The SoundComponentSetOutput function is intended for sophisticated sound output device components that might want to reinitialize the Apple Mixer.
Only the Apple Mixer component needs to implement this function.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)